package com.xp.kettlegenerate.enu;

/*******
 *  数据库类型驱动枚举
 */
public enum DataBaseDriverEnum {

    /******
     *  达梦数据库驱动
     */
    DM("dm","dm.jdbc.driver.DmDriver"),
    /*****
     *  mysql 驱动
     */
    MYSQL("mysql","com.mysql.cj.jdbc.Driver"),
    /*****
     * oracle 驱动
     */
    ORACLE("oracle","oracle.jdbc.driver.OracleDriver"),
    /*****
     *  sqlServer 驱动
     */
    SQL_SERVER("sqlServer","com.microsoft.sqlserver.jdbc.SQLServerDriver"),

    /*******
     *  人大金仓驱动
     */
    KING_BASE("kingBase","com.kingbase.Driver");


    public String dbType;
    public String driverClass;

    DataBaseDriverEnum(String dbType, String driverClass) {
        this.dbType = dbType;
        this.driverClass = driverClass;
    }

    public static String getDriver(String dbType){
        DataBaseDriverEnum[] values = DataBaseDriverEnum.values();
        for (int i = 0,j = values.length; i < j; i++) {
            DataBaseDriverEnum value = values[i];
            if(value.dbType.equalsIgnoreCase(dbType)){
                return value.driverClass;
            }
        }
        return "";
    }




}
